home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / comm / tcp / MCF_Buttons.lha / MCF_Buttons / Rexx / MCF_Buttons.amirx < prev    next >
Encoding:
Text File  |  1998-10-06  |  11.4 KB  |  15 lines

  1. /* MCF_Buttons.amirx
  2. // $VER: MCF_Buttons.amirx 5.8 (22.06.98)
  3. \\ Written by Donald T. Becker (dtbecker@ptd.net) IRC: StarDustr
  4. // Please mail any bug reports/comments to the above address with a subject
  5. \\ header of MCF_Buttons
  6. //
  7. \\  MUI GUI portion of scripts uses 2 ports
  8. //      MCFGB  for the MUIRexx Port
  9. \\      MCFRB  for the Rexx Port
  10. //
  11. \\ ** What to do with this file?
  12. // Put this script in your AmIRC/Rexx directory.
  13. \\     Start by typing in AmIRC:  /Rx MCF_Buttons [X/S] [DEBUG/S] [NODELETE/S]
  14. */
  15. ;arg argline;delete=1;debug=0;do act=1 by 1 while argline ~="";parse value argline with xarg argline;select;when xarg="X" then xfunc="X";when xarg="DEBUG" then debug=1;when xarg="NODELETE" then delete=0;otherwise NOP;end;end act;Cenv=address();Options Results;Ecmd="Say";PSscreen="";if 0=pos("AMIRC.",Cenv) then;MCFenv="AMIRC.1";else;do;MCFenv=Cenv;"INFO screen";PSscreen=result;if PSscreen='RESULT' then PSscreen="";Ecmd='"ECHO P = "d2c(27)"««Buttons»"';end;if show('p',"MCFGB")|show('p',"MCFRB") then;do;if xfunc ~='X' then;do;interpret Ecmd '"MUI Port for Buttons already Active.  EOJ."';exit;end;if ~show('p',"MCFRB") then;address MCFGB "'QUIT'";else address MCFRB "'CALL QUIT()'";address command wait 2 sec;end;Client=right(MCFenv,1);if ~show('L',"rexxsupport.library") then;do;if ~addlib("rexxsupport.library",0,-30,0) then;do;interpret Ecmd '"rexxsupport.library Open Failure.  EOJ."';exit;end;end;if exists("ENV:mui/MCFGB.cfg") then address command delete ">nil: ENV:mui/MCFGB.cfg";if exists("ENVARC:mui/MCFGB.cfg") then address command delete ">nil: ENVARC:mui/MCFGB.cfg";MCmd="";MRexx=showlist('A',MuiRexx)+showlist('V',MuiRexx);if MRexx then MRexx=exists("MuiRexx:MuiRexx");if exists("SYS:RexxC/MuiRexx") then MCmd="SYS:RexxC/MuiRexx";if MRexx then MCmd="MuiRexx:MuiRexx";if exists("SYS:Utilities/MuiRexx") then MCmd="SYS:Utilities/MuiRexx";if MCmd="" then;do;interpret Ecmd '"MuiRexx not found.  EOJ."';exit;end;if ~openport(MCFRB) then;do;interpret Ecmd '"MCFRB OpenPort failure.  EOJ."';exit;end;if ~exists("ENV:mui/MCFGB.prefs") then;if exists("ENVARC:mui/MCFGB.prefs") then;address command "Copy >Nil: ENVARC:mui/MCFGB.prefs ENV:mui/MCFGB.prefs";Application_AboutMUI=0x8042d21d;Application_Load=0x8042f90d;Application_OpenConfigWindow=0x804299ba;Menuitem_Shortcut=0x80422030;Menuitem_Title=0x804218be;MUIA_Background=0x8042545b;MUIA_Frame=0x8042ac64;MUIA_Pressed=0x80423535;MUIA_Slider_Level=0x8042ae3a;MUIA_Slider_Max=0x8042d78a;MUIA_Slider_Min=0x8042e404;MUIA_Weight=0x80421d1f;MUIA_Window_Activate=0x80428d2f;MUIA_Window_CloseGadget=0x8042a110;MUIA_Window_CloseRequest=0x8042e86e;MUIA_Window_DragBar=0x8042045d;MUIA_Window_Open=0x80428aa0;MUIA_Window_PublicScreen=0x804278e4;MUII_WindowBack=0;MUIV_Frame_Text=3;address command "run >nil:" MCmd port MCFGB;address command "waitforport MCFGB";a1="'";Warg.0.0="/Rx MCF_About MCFGB";Warg.0.1="/Rx MCF_Buttons x";setclip("MCFGB_Title","MCF_Buttons");setclip("MCFGB_Version","$VER: MCF_Buttons 5.8 (22.06.98)");setclip("MCFGB_Copyright","March 1997  by StarDustr");setclip("MCFGB_Author","StarDustr  @Dal.net on #AmIRC");setclip("MCFGB_Description","A Buttons Window for ALL your AmIRC Clients");Wl.1="/* MCFGB.rexx */";Wl.2=address MCFGB;Wl.3=window ID """MAIN""" COMMAND a1"""call Quit()"""a1 port MCFRB ATTRS MUIA_Window_Activate "'0'" MUIA_Window_PublicScreen a1'"'PSscreen'"'a1 MUIA_Window_DragBar "'1'" MUIA_Window_CloseGadget "'1'";Wl.4=menu LABEL "'MCF Buttons'";Wl.5=item COMMAND a1"""HIDE"""a1 port MCFGB ATTRS Menuitem_Shortcut "'I'" LABEL "'Iconify'";Wl.6=menu LABEL "'About'";Wl.7=item COMMAND a1"""Call DoFunc(0 0)"""a1 port MCFRB LABEL "'About MCF_Buttons'";Wl.8=item COMMAND a1'"'method a1||Application_AboutMUI||a1 0'"'a1 port MCFGB LABEL "'About MUI'";Wl.9=endmenu;Wl.10=menu LABEL "'Settings'";Wl.11=item COMMAND a1'"'method a1||Application_OpenConfigWindow||a1'"'a1 port MCFGB LABEL "'MUI...'";Wl.12=endmenu;Wl.13=item ATTRS Menuitem_Title "'-1'";Wl.14=menu LABEL "'ReLoad Buttons'";Wl.15=item COMMAND a1"""Call ReLoad()"""a1 port MCFRB LABEL "'Buttons Data'";Wl.16=item COMMAND a1"""Call DoFunc(0 1)"""a1 port MCFRB LABEL "'Buttons Script'";Wl.17=endmenu;Wl.18=item ATTRS Menuitem_Title "'-1'";Wl.19=item COMMAND a1"""Call Quit()"""a1 port MCFRB ATTRS Menuitem_Shortcut "'Q'" LABEL "'Quit'";Wl.20=endmenu;Wl.21=group frame label "'Client'";Wl.22=group;Wl.23=cycle ID TXTC COMMAND a1"""call DoClient(%s)"""a1 PORT MCFRB Labels """AMIRC.1,AMIRC.2,AMIRC.3,AMIRC.4,AMIRC.5,AMIRC.6,AMIRC.7,AMIRC.8,AMIRC.9""";Wl.24=endgroup;Wl.25=endgroup;open('in',MCmd);if c2x(right(readch('in',24),2))="2570" then;do;Wl.4=menu LABEL a1"""MCF Buttons"""a1;Wl.7=item COMMAND a1"""Call DoFunc(0 0)"""a1 port MCFRB LABEL a1"""About MCF_Buttons"""a1;Wl.8=item COMMAND a1'"'method a1||Application_AboutMUI||a1 0'"'a1 port MCFGB LABEL a1"""About MUI"""a1;Wl.14=menu LABEL a1"""ReLoad Buttons"""a1;Wl.15=item COMMAND a1"""Call ReLoad()"""a1 port MCFRB LABEL a1"""Buttons Data"""a1;Wl.16=item COMMAND a1"""Call DoFunc(0 1)"""a1 port MCFRB LABEL a1"""Buttons Script"""a1;end;call close('in');call ReadButtons();signal DoWait;ReadButtons:;MCFfile='P';if ~open("In","MCF.Buttons",'r') then;do;if showlist('A',AMIRC) then;if open("In","AMIRC:MCF.Buttons",'r') then MCFfile='A';if showlist('A',MCF)&MCFfile='P' then;if open("In","MCF:MCF.Buttons",'r') then MCFfile='M';if MCFfile='P' then;do;interpret Ecmd '"MCF.Buttons not found.  EOJ."';signal Quit;end;end;xx="";do until xx='#';bline=readln("In");parse value bline with xx zz;end;if upper(zz) ~='AMIRC' then;do;interpret Ecmd '"MCF.Buttons #AMIRC label not found.  EOJ."';signal Quit;end;Flabel="1";Fpage=1;do ocnt=1 by 1 until zz='END';icnt=0;if icnt=0&ocnt>1 then;do;Fpage=Fpage+1;Flabel=Flabel||','||Fpage;end;Title.ocnt=strip(zz);do until xx='#';bline=readln("In");parse value bline with xx zz;if xx='#' then iterate;if xx='!' then;do;tcnt=icnt+1;Tframe.ocnt.tcnt='Y';Wframe.ocnt.tcnt=strip(zz);iterate;end;icnt=icnt+1;Wbut.ocnt.icnt=xx;Warg.ocnt.icnt=strip(zz);if Wbut.ocnt.icnt='@' then;do;parse value Warg.ocnt.icnt with Wbut.ocnt.icnt PSmin.ocnt.icnt PSmax.ocnt.icnt Warg.ocnt.icnt;Warg.ocnt.icnt=strip(Warg.ocnt.icnt);end;if upper(left(Warg.ocnt.icnt,2))='/H' then;do;ehpos=pos('H/',upper(Warg.ocnt.icnt))-3;if ehpos>0 then;Htxt.ocnt.icnt=strip(substr(Warg.ocnt.icnt,3,ehpos));Warg.ocnt.icnt=strip(substr(Warg.ocnt.icnt,ehpos+5));end;if debug then Warg.ocnt.icnt=substr(Warg.ocnt.icnt,2);end;do icnt=icnt by-1 while Tframe.icnt='Y';end;Wmax.ocnt=icnt;end;StartMUI:;bline=readln("In");parse value bline with xx zz MCFwww;if zz="WWW" then signal CloseIn;call close("In");if WWWflag='Y' then signal AddressPort;WWWflag='Y';if MCFfile='A' then zz=open("In","AMIRC:MCF.Buttons",'a');if MCFfile='P' then zz=open("In","MCF.Buttons",'a');if MCFfile='M' then zz=open("In","MCF:MCF.Buttons",'a');if ~zz then signal AddressPort;address MCFGB window ID 'WWW' ATTRS MUIA_Window_Activate 1 MUIA_Window_PublicScreen PSscreen;address MCFGB group;address MCFGB text TRANS ATTRS MUIA_Frame 0 label "\n  Selecting a Web Browser for MCF Buttons.\n\n     Select the Volume and then select \n    Program that you wish to use as your\n     Default WebBrowser for MCF_Buttons.\n";address MCFGB group HORIZ;address MCFGB volumelist COMMAND '"V %s"' PORT MCFRB ATTRS MUIA_Weight 20;address MCFGB dirlist ID WWWD PRESS COMMAND '"P %s"' PORT MCFRB ATTRS MUIA_Weight 80 PATH "Ram:";address MCFGB endgroup;address MCFGB popasl command '"%s"' port MCFRB;address MCFGB endgroup;address MCFGB endwindow;GetWWW:;call waitpkt(MCFRB);xx=getpkt(MCFRB);if xx='00000000'x then signal GetWWW;MCFwww=getarg(xx);call reply(xx);parse value MCFwww with Wfunc MCFwww junk;if Wfunc='V' then;do;Address MCFGB dirlist ID WWWD PATH MCFwww;signal GetWWW;end;parse value statef(MCFwww) with ftype junk;if ftype='DIR' then;do;Address MCFGB dirlist ID WWWD PATH MCFwww;signal GetWWW;end;call writeln("In","# WWW "||MCFwww);address MCFGB 'window ID WWW close';CloseIn:;setclip("mcfb_WWW",MCFwww);call close("In");AddressPort:;Wl.26=group ATTRS MUIA_Weight "'100'" register labels '"'Flabel'"';Wc=26;do cnto=1 to ocnt;Wc=Wc+1;Wl.Wc=group scroll;Wc=Wc+1;Wl.Wc=group frame label '"'Title.cnto'"';Fflag='N';do cnti=1 to Wmax.cnto;if Tframe.cnto.cnti="Y" then;do;if Fflag='Y' then;do;Wc=Wc+1;Wl.Wc=endgroup;end;Wc=Wc+1;Wl.Wc=group frame label '"'Wframe.cnto.cnti'"';Fflag='Y';end;Fcmd=a1'"'"Call DoFunc("||cnto cnti||")"'"'a1;if PSmin.cnto.cnti ~="PSMIN."cnto"."cnti then;do;if Htxt.cnto.cnti="HTXT."cnto"."cnti then;Htxt="";else Htxt=help a1'"'Htxt.cnto.cnti'"'a1;Scmd=a1'"'"Call SetFunc("||cnto cnti "(%s))"'"'a1;Wc=Wc+1;Wl.Wc=group horiz;Wc=Wc+1;Wl.Wc=button COMMAND Fcmd Htxt PORT MCFRB ATTRS MUIA_Weight "'60'" label '"'Wbut.cnto.cnti'"';Wc=Wc+1;Wl.Wc=space;Wc=Wc+1;Wl.Wc=popslider ATTRS MUIA_Weight "'200'" COMMAND Scmd PORT MCFRB ATTRS MUIA_Slider_Min a1'"'PSmin.cnto.cnti'"'a1 MUIA_Slider_Max a1'"'PSmax.cnto.cnti'"'a1;Wc=Wc+1;Wl.Wc=space;Wc=Wc+1;Wl.Wc=endgroup;if PSmin.cnto.cnti<0&PSmax.cnto.cnti>0 then PSmin.cnto.cnti=0;iterate cnti;end;if Htxt.cnto.cnti="HTXT."cnto"."cnti then;Htxt="";else Htxt=help a1'"'Htxt.cnto.cnti'"'a1;Wc=Wc+1;Wl.Wc=button command Fcmd Htxt port MCFRB label '"'Wbut.cnto.cnti'"';end cnti;if Fflag='Y' then;do;Wc=Wc+1;Wl.Wc=endgroup;end;Wc=Wc+1;Wl.Wc=endgroup;Wc=Wc+1;Wl.Wc=endgroup;end cnto;Wc=Wc+1;Wl.Wc=endgroup;Wc=Wc+1;Wl.Wc=endwindow;Wc=Wc+1;Wl.Wc=method Application_Load 0;Wc=Wc+1;Wl.Wc=cycle ID TXTC label MCFenv;call open("Script","Ram:MCFGB.Rexx",'w');do wcnt=1 to Wc;call writeln("Script",Wl.wcnt);end wcnt;call close("Script");address command "Rx >Nil: Ram:MCFGB";if delete then address command "Delete >Nil: Ram:MCFGB.rexx";drop Wbut. PSmax. Htxt.;return;DoWait:;Address Rexx;call waitpkt(MCFRB);xx=getpkt(MCFRB);if xx='00000000'x then signal DoWait;Barg=getarg(xx);call reply(xx);select;when upper(left(Barg,4))="CALL" then;do;interpret Barg;signal DoWait;end;otherwise NOP;end;Quit:;call closeport(MCFRB);setclip("mcfb_WWW");setclip("MCFGB_Title");setclip("MCFGB_Version");setclip("MCFGB_Copyright");setclip("MCFGB_Author");setclip("MCFGB_Description");Address MCFGB 'quit';exit;SetFunc:;arg focnt ficnt psnum;PSmin.focnt.ficnt=strip(psnum);return;DoFunc:;arg focnt ficnt junk;Lval=Warg.focnt.ficnt;PSval=PSmin.focnt.ficnt;DoButton:;if ~show('p',MCFenv) then return;if 0=pos('%',Lval) then signal DoAction;interpret "address" MCFenv;npos=pos('%n',Lval);if npos ~=0 then;do;drop result;getmynick;MyNick=result;Mlen=length(MyNick);Tval=Lval;do until npos=0;Lval=left(Tval,npos-1)||MyNick||substr(Tval,npos+2);Tval=Lval;npos=pos('%n',Lval);end;end;npos=pos('%c',Lval);if npos ~=0 then;do;drop result;getchannel;CurChan=result;if CurChan="" then;do;"ECHO P = "d2c(27)"««Buttons»" d2c(2)"Button Error"d2c(2)".  Current Channel not Found.";return;end;Clen=length(CurChan);Tval=Lval;do until npos=0;Lval=left(Tval,npos-1)||CurChan||substr(Tval,npos+2);Tval=Lval;npos=pos('%c',Lval);end;end;npos=pos('%u',Lval);if npos ~=0 then;do;drop result;getselecteduser;SUser=result;if SUser="RESULT" then;do;"ECHO P = "d2c(27)"««Buttons»" d2c(2)"Button Error"d2c(2)".  Selected User not Found.";return;end;Slen=length(SUser);Tval=Lval;do until npos=0;Lval=left(Tval,npos-1)||SUser||substr(Tval,npos+2);Tval=Lval;npos=pos('%u',Lval);end;end;Uval=upper(Lval);npos=pos('%#',Uval);if npos ~=0 then;do;Tval=Lval;do until npos=0;Lval=left(Tval,npos-1)||PSval||substr(Tval,npos+2);Tval=Lval;Uval=upper(Tval);npos=pos('%#',Uval);end;end;DoAction:;interpret "address" MCFenv "say Lval";return;DoClient:;arg Baction;if ~show('p',Baction) then;do;address MCFGB cycle ID TXTC label MCFenv;return;end;MCFenv=Baction;return;ReLoad:;address MCFGB window id MAIN close;call ReadButtons();return